<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class ChapterDetail extends BaseModel
{
    use HasFactory;

    //关联章节表 通过中间表ChapterToDetail
    public function chapter()
    {
        return $this->belongsTo(Chapter::class, 'chapter_id');
    }

    //关联章节表 通过中间表ChapterToDetail
    public function chapterToDetail()
    {
        return $this->hasOne(Chapter::class, ChapterToDetail::class, 'chapter_id', 'chapter_detail_id');
    }
}
